newbie

newbie

am 18.09.2007 13:31:36 von cory

Hi at all, I'm newbie in php and I'm searching to make function one
project that I found in a school book, the project is ok because it
functions a part some script. I'd like to know which is the error.
I'm working on win xp pro and on it I have installed a server apache
ver.2.2.4
php ver. 5.2.4, mysql server and client ver.
3.23

I report you the problem:
When I compile the form, my data that I fill in, it has not
processed.The thing strange is that when I change version of Apache,
version of php, And version of mysql the problem becomes another in
other words is another script that don't go.
here is the script:

include ("admin/config.php");
include ("admin/users.php");

########################################################
## NEW MEMBER REGISTER
########################################################
if($register=="Register New Member"){


//****************************
// CHECK FOR USER AND EMAIL **
//****************************

$SELECT_USERS = mysql_query("SELECT * FROM users WHERE
Username='$username'",$db);
$USER_EXISTS = mysql_num_rows($SELECT_USERS);

$SELECT_EMAILS = mysql_query("SELECT * FROM users WHERE
Email='$email'",$db);
$EMAIL_EXISTS = mysql_num_rows($SELECT_EMAILS);



//******************
// BEGIN CHECK **
//******************

if(strlen($firstname)<3){$msg[1] = "Firstname too short";}
if(strlen($surname)<3) {$msg[2] = "Surname too short";}
if(strlen($telephone)<6){$msg[3] = "Not a valid phone number";}
if(strlen($email)<3) {$msg[4] = "Not a valid e-mail address";}
if(strlen($address)<10) {$msg[5] = "Address is too short";}
if(strlen($city)<3) {$msg[6] = "City name too short";}
if(strlen($postcode)<4) {$msg[7] = "Postcode too short";}
if(strlen($country)<3) {$msg[8] = "Country too short";}

if($EMAIL_EXISTS) {$msg[4] = "E-mail already exists";}

if(strlen($username)<3) {$msg_user = "Very short username";}

if($USER_EXISTS) {$msg_user = "Username already exists";}
else{$user_ok = 1;}

if(strlen($password)<6) {$msg_pass = "Please use more than 6
characters";}
else{$pass_ok = 1;}

if((count($msg)!= 0)||(!$user_ok)||(!$pass_ok)) {$msg[0] = "Error on
creating new account";}
else{$details_ok = 1;}


//*****************************
// SUCCESSIVE REGISTRATION **
//*****************************

if(($details_ok)&&($user_ok)&&($pass_ok)){

$md5_password = md5($password);

$INSERT = mysql_query("INSERT INTO users (
Username,
Password,
Firstname,
Surname,
Company,
Address,
City,
County,
Postcode,
Country,
Telephone,
Mobile,
Fax,
Email
)

VALUES (
'$username',
'$md5_password',
'$firstname',
'$surname',
'$company',
'$address',
'$city',
'$county',
'$postcode',
'$country',
'$telephone',
'$mobile',
'$fax',
'$email'
)",$db);

if($INSERT){$meta_next = "";
$msg[0]= "Thank You!";


//*****************************
// INSERT CARDHOLDER DETAILS **
//*****************************
$INSERT_CARDHOLDER = mysql_query("INSERT INTO cardholders (

Username,
Firstname,
Surname,
Address,
City,
Postcode,
Country,
Telephone,
Email,
Mobile,
Fax,
Cardtype,
Cardname,
Cardnumber,
Cardexpire
)

VALUES (
'$username',
'$firstname',
'$surname',
'$address',
'$city',
'$postcode',
'$country',
'$telephone',
'$email',
'$mobile',
'$fax',
'$cardtype',
'$username',
'$cardnumber',
'$cardexpire'
)",$db);

if($INSERT_CARDHOLDER){$msg_cardholder = "Done!";}
else{$msg_cardholder = "Error";}


//*****************************
// INSERT SHIPPING DETAILS **
//*****************************
$INSERT_SHIPPING = mysql_query("INSERT INTO shipping (

Username,
Firstname,
Surname,
Address,
City,
Postcode,
Country,
Telephone
)

VALUES (
'$username',
'$firstname',
'$surname',
'$address',
'$city',
'$postcode',
'$country',
'$telephone'
)",$db);

if($INSERT_SHIPPING){$msg_shipping = "Done!";}
else{$msg_shipping = "Error";}


//***************************************************
//REPLACE ANONYMOUS ITEM SELECTIONS/NORMAL USERNAME *
//***************************************************

$SELECT_ITEMS = mysql_query("SELECT * FROM cart WHERE
Username='$user'",$db);
$DELETE_USER = mysql_query("DELETE FROM users_anonymous WHERE
IDName='$user'",$db);

while($item = mysql_fetch_array($SELECT_ITEMS)){

$UPDATE_ITEMS = mysql_query("UPDATE cart SET
Username ='$username',
Date ='$tdate'
WHERE Username='$user'",$db);
}

//***************************************************
//MAKES THE USER A MEMBER *
//***************************************************

$loggedin=1;
$set_cookie = setcookie ("customer","$username",time()+2600000);


}
else{$meta_next = NULL;}
}

}

?>



<?=$conf[title];?>







height="575">




















width="190" height="101">
  

width="26" align="right">
align="center" class="text_small_1">

width="10" height="10">



class="menu_1">   b>REGISTER
height="168" align="center">








cellpadding="3" class="text_small_1">









Personal Member Details: class="register">




cellpadding="3" height="78" bgcolor="#ECEEF0">








































































width="21%">Firstname:
value="">
*

width="21%">Surname:
value="">
*

width="21%">Company:
value="">
background="images/seprow.gif">
width="21%">Address:

*

width="21%">City:
value="">
*

width="21%">Postcode:
value="">
*

width="21%">Country:
value="">
*

width="21%">Telephone:
value="">
*

width="21%">Mobile:
value="">
width="21%">Fax:
value="">
E-
mail:

value="">
*

background="images/seprow.gif">
width="21%">Username:
value="">
*

width="21%">Password:
class="boxes">
*

background="images/seprow.gif">
width="21%">Mailing list?
checked>
Receive any latest
news on your
e-mail!
bgcolor="#E6E6E6">
bgcolor="#E6E6E6">
value="Register New Member" class="buttons">

colspan="2" bgcolor="#E6E6E6">



href="index.php">











width="174">





Re: newbie

am 18.09.2007 13:38:33 von Jerry Stuckle

cory wrote:
> Hi at all, I'm newbie in php and I'm searching to make function one
> project that I found in a school book, the project is ok because it
> functions a part some script. I'd like to know which is the error.
> I'm working on win xp pro and on it I have installed a server apache
> ver.2.2.4
> php ver. 5.2.4, mysql server and client ver.
> 3.23
>
> I report you the problem:
> When I compile the form, my data that I fill in, it has not
> processed.The thing strange is that when I change version of Apache,
> version of php, And version of mysql the problem becomes another in
> other words is another script that don't go.
> here is the script:
>

(lots of code snipped)

You haven't told us what the error you're getting is. And not many
people are going to look through hundreds of lines of code to help you
try to find your error. I suggest you create a test which duplicates
the problem in a small amount of code.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================